export SHELL ?= /bin/bash
export ROOTDIR ?= $(PWD)/../../..
include $(ROOTDIR)/Makefile.globals
include $(ROOTDIR)/config.mk

INCLUDES += -I$(ROOTDIR)/drivers/hbi/inc 

OBJS = $(INSTALL_LIB_PATH)/hbi_u.o $(INSTALL_LIB_PATH)/hbi_tw.o

build:
	@if echo "#include <arpa/inet.h> " | $(CC) -E - >/dev/null 2>&1;\
	then \
	    echo "Build MiTuner bridge with arpa/inet header files";\
	    $(CC) $(OBJS) mituner_bridge_server.c $(EXTRA_CFLAGS) $(INCLUDES) $(DEFINES) -DARPA_AVAILABLE -o mituner_bridge_server;\
	else \
	    echo "Build MiTuner bridge without arpa/inet header files";\
	    $(CC) $(OBJS) mituner_bridge_server.c $(EXTRA_CFLAGS) $(INCLUDES) $(DEFINES) -o mituner_bridge_server;\
	fi
	@echo "Created \""$(PWD)"/mituner_bridge_server\""
	@echo "Start \"mituner_bridge_server\" before attempting to connect to the target with MiTuner"

